<template>
  <div id="button">
    <h1>学生管理</h1>
    <p>学生学号：{{studentInfo.id}}</p>
    <p>学生姓名：{{studentInfo.name}}</p>
    <p>学生年龄：{{studentInfo.age}}</p>
    <p>学生性别：{{studentInfo.sex}}</p>
    <button @click="sendStudentName">发送学生名称</button>
  </div>
</template>

<script>
export default {
    name:'Student',
    data(){
        return{
            studentInfo:{
                id:'12w3243',
                name:'zhangzhang',
                age:23,
                sex:'男'
            }
        }
    },
    methods:{
        sendStudentName(){
            this.$emit('getStudentName',this.studentInfo.name)
        }
    }
}
</script>

<style scoped>
    #button{
        background-color: pink;
    }
</style>